package com.fly.springbootTemplate.serviceImpl;

import com.fly.springbootTemplate.dao.RoleDao;
import com.fly.springbootTemplate.entity.Role;
import com.fly.springbootTemplate.service.RoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Collections;
import java.util.List;

@Service
public class RoleServiceImpl implements RoleService {
    @Autowired
    private RoleDao roleDao;
    @Override
    public boolean addRole(Role role) {
        return roleDao.insertRole(role);
    }

    @Override
    public boolean deleteRole(Integer role_id) {
        return roleDao.deleteRole(role_id);
    }

    @Override
    public boolean updateRole(Role role) {
        return roleDao.updateRole(role);
    }

    @Override
    public List<Role> getAllRole() {
        return roleDao.selectAllRole();
    }

    @Override
    public Role getRoleById(Integer role_id) {
        return roleDao.selectRoleById(role_id);
    }
}
